// ***********************************************************************************************
// Tutorial 01 : Getting started
// Copyright (C) Havok.com Inc. All rights reserved.
// ***********************************************************************************************
// Shows the basic steps needed to initialize the Vision Engine.
// This sample uses shared\src\VisSampleApp.cpp to take care of initializing the engine
// ***********************************************************************************************

#include "StdAfx.h"
#include "MobileGame.h"

VisSampleAppPtr spApp;

VISION_INIT
{
//	_CrtSetBreakAlloc(217);
	// setup directories, does nothing on platforms other than iOS, 
	// pass true if you want load from the documents directory
	VISION_SET_DIRECTORIES(false);
	  
	// Create an application
	spApp = new VisSampleApp(); 
	spApp->LoadVisionEnginePlugin();
	VISION_PLUGIN_ENSURE_LOADED(vHavok);
	VISION_PLUGIN_ENSURE_LOADED(vFmodEnginePlugin);

	spApp->SetShowFrameRate(false);

	spApp->m_appConfig.m_videoConfig.m_szWindowTitle = "ProjectBokoBoko";

	// Init the application
#ifdef _VISION_MOBILE
	if (!spApp->InitSample("ViewerMap" /*DataDir*/, "Project_Slice" /*SampleScene*/ ))
#else
	if (!spApp->InitSample("..\\..\\EngineSamples\\ProjectFilesAndroid\\ProjectBokoBoko\\assets\\data" /*DataDir*/, "Project_Slice" /*SampleScene*/, VSAMPLE_INIT_DEFAULTS, 1280, 720 ))
	//if(!VisionEngine::GetInstance().Init("..\\..\\EngineSamples\\ProjectFilesAndroid\\Project_Slice\\assets\\data" /*DataDir*/, "Project_Slice" /*SampleScene*/, VSAMPLE_INIT_DEFAULTS, 1280, 800 ))
#endif
		return false;

 	if(!CMobileGame::GetInstance().Init())
 		return false;
	  
	return true;
}

VISION_SAMPLEAPP_AFTER_LOADING
{
	CMobileGame::GetInstance().SetGame();
}

VISION_SAMPLEAPP_RUN
{
//   	if(!CMobileGame::GetInstance().Run())
//   		return false;

	return spApp->Run();
}

VISION_DEINIT
{
	CMobileGame::GetInstance().Destroy();

	// Deinit the application
	spApp->DeInitSample();
	spApp = NULL;
	return true;
}

VISION_MAIN_DEFAULT
